package com.migration.model.newdb;

import jakarta.persistence.*;
import lombok.Data;
import java.io.Serializable;

/**
 * 事故链-原因表 实体类
 * 表名：risk_chain_cause
 * 自动生成的实体类
 */
@Data
@Entity
@Table(name = "risk_chain_cause")
public class RiskChainCause implements Serializable {

    private static final long serialVersionUID = 1L;
    
    /**
     * 主键ID
     * 主键
     */
    @Id
    @Column(name = "id", nullable = false, length = 50)
    private String id;
    
    /**
     * 租户ID
     */
    @Column(name = "tenant_id", nullable = false)
    private Long tenantId;
    
    /**
     * 部门ID
     */
    @Column(name = "department_id", nullable = false)
    private Long departmentId;
    
    /**
     * 分析类型1：连续工艺，2：间隙工艺，3：JSA操作
     */
    @Column(name = "analysis_type", nullable = false)
    private Integer analysisType;
    
    /**
     * 根据分析类型指向设备-偏离、设备-步骤、设备-操作表ID
     */
    @Column(name = "analysis_id", nullable = false)
    private Long analysisId;
    
    /**
     * 来源ID 同一来源ID被认为是同一个原因
     */
    @Column(name = "from_id", nullable = false, length = 50)
    private String fromId;
    
    /**
     * 原因描述
     */
    @Column(name = "cause_desc", nullable = false, length = 255)
    private String causeDesc;
    
    /**
     * 原因类型
     */
    @Column(name = "cause_type", nullable = false)
    private Integer causeType;
    
    /**
     * 位号
     */
    @Column(name = "tag_number", length = 50)
    private String tagNumber;
    
    /**
     * 可能性表ID
     */
    @Column(name = "likelihood_id", nullable = false)
    private Long likelihoodId;
    
    /**
     * 是否有后果0：无，1：有
     * 默认值: 0
     */
    @Column(name = "has_result")
    private Boolean hasResult;
    
    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 20)
    private String createTime;
    
    /**
     * 更新时间
     */
    @Column(name = "update_time", length = 20)
    private String updateTime;
    
    /**
     * 创建人
     */
    @Column(name = "create_by")
    private Long createBy;
    
    /**
     * 更新人
     */
    @Column(name = "update_by")
    private Long updateBy;
    
    /**
     * 逻辑删除标志（0：正常，1：删除）
     * 默认值: 0
     */
    @Column(name = "is_del")
    private Boolean isDel;
    
    @Override
    public String toString() {
        return "RiskChainCause{" +
            "id=" + id +
            ", tenantId=" + tenantId +
            ", departmentId=" + departmentId +
            ", analysisType=" + analysisType +
            ", analysisId=" + analysisId +
            ", fromId=" + fromId +
            ", causeDesc=" + causeDesc +
            ", causeType=" + causeType +
            ", tagNumber=" + tagNumber +
            ", likelihoodId=" + likelihoodId +
            ", hasResult=" + hasResult +
            ", createTime=" + createTime +
            ", updateTime=" + updateTime +
            ", createBy=" + createBy +
            ", updateBy=" + updateBy +
            ", isDel=" + isDel +
        '}';
    }
} 